找传奇、传世资源到传世资源站!

tcp 半开连接扫描

8.5玩家评分(1人评分)
下载后可评
介绍 评论 失效链接反馈

tcp半开连接扫描,扫描速度快tcp 半开连接扫描 C#网络编程-第1张
using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Net;using System.Text;using System.Threading;using System.Windows.Forms;using Metro;using Metro.Scanning;namespace WindowsFormsApplication1{ class Program { static void Main(string[] args) { Console.WriteLine("请输入要扫描的Ip地址"); string ip = Console.ReadLine(); Console.WriteLine("请输入要扫描的端口起始地址,用\",\"号分隔"); string txt = Console.ReadLine(); if (txt == null) return; args = txt.Split(','); ushort beginPort = ushort.Parse(args[0]); ushort endPort = ushort.Parse(args[1]); int length = endPort - beginPort; ushort[] ports = new ushort[length]; for (ushort i = 0; i < length; i ) ports[i] = (ushort)(beginPort i); NetworkInterfaceList list = new NetworkInterfaceList(); foreach (NetworkInterface ls in list.Interfaces) { TcpSynScanner scanner = new TcpSynScanner(new IPEndPoint(ls.Address, 0)); scanner.PortReply = scanner_PortReply; try { scanner.StartScan(IPAddress.Parse(ip), ports); } catch (Exception ex) { MessageBox.Show(ex.Message); } break; } Console.ReadLine(); } static void scanner_PortReply(IPEndPoint remoteEndPoint, TcpPortState state) { string txt = string.Format("{0}:{1}=>{2}", remoteEndPoint.Address, remoteEndPoint.Port, state); Console.WriteLine(txt); } }}

评论

发表评论必须先登陆, 您可以 登陆 或者 注册新账号 !


在线咨询: 问题反馈
客服QQ:174666394

有问题请留言,看到后及时答复